﻿<%@ WebHandler Language="C#" Class="Brand_Add" %>

using System;
using System.Web;
using Newtonsoft.Json;
public class Brand_Add : IHttpHandler, System.Web.SessionState.IReadOnlySessionState 
{
    OTS.BLL.BrandBLL bll = new OTS.BLL.BrandBLL();
    public void ProcessRequest (HttpContext context) 
    {
        //检验是否登录
        OTS.Common.PageSuccess page = new OTS.Common.PageSuccess();
        if (!OTS.BaseLogin.validataModule(context, (int)OTS.enumSysRight.ProductTypeManager))
        {
            page.success = false;
            page.msg = "非法操作！";

        }
        else
        {
            string _name = context.Request["brand.name"];
            string _title = context.Request["brand.title"];



            if (null != _name && !"".Equals(_name)  )
            {
                OTS.Model.Brand model = new OTS.Model.Brand();
                model.brand_name = _name;
                model.title = _title;
                model.des = "";
                model.brand_topshow = "";
                model.brand_logopic = "";
                model.brand_pic = "";
                model.brand_rightpiclogo = "";
                model.brand_toplogo = "";
                
                bll.Add(model);

                page.success = true;
                page.msg = "添加成功！";
            }
            else
            {
                page.success = false;
                page.msg = "参数有误！";

            }

        }
        context.Response.ContentType = "application/x-json";
        context.Response.Charset = "utf-8";
        context.Response.Write(JavaScriptConvert.SerializeObject(page));
    }
 
    public bool IsReusable {
        get {
            return false;
        }
    }

}